smsc95xx: fix operation on 64-bit systems
authorStephen Warren <[email protected]>
Wed, 23 Mar 2016 04:28:16 +0000 (22:28 -0600)
committerTom Rini <[email protected]>
Fri, 1 Apr 2016 21:17:40 +0000 (17:17 -0400)
smsc95xx_read_reg() should calculate sizeof(*data) not sizeof(data) since
data is a pointer, and the value pointed at is being transferred over USB,
not the value of the pointer. This fixes operation of the driver in 64-bit
builds, such as the Raspberry Pi 3.

Reported-by: Eric Anholt <[email protected]>
Signed-off-by: Stephen Warren <[email protected]>
Acked-by: Marek Vasut <[email protected]>
Acked-by: Joe Hershberger <[email protected]>
drivers/usb/eth/smsc95xx.c

index 3099bf4fd4e5d5f8151fd5d65e4b7931c4760f71..08eaed5c2e03736a3df040e41ceb7bbdf8c11eae 100644 (file)
@@ -188,10 +188,10 @@ static int smsc95xx_read_reg(struct usb_device *udev, u32 index, u32 *data)
        len = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
                              USB_VENDOR_REQUEST_READ_REGISTER,
                              USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
-                             0, index, tmpbuf, sizeof(data),
+                             0, index, tmpbuf, sizeof(*data),
                              USB_CTRL_GET_TIMEOUT);
        *data = tmpbuf[0];
-       if (len != sizeof(data)) {
+       if (len != sizeof(*data)) {
                debug("smsc95xx_read_reg failed: index=%d, len=%d",
                      index, len);
                return -EIO;